<template>
    <Title title="推荐MV" class="mt-5"/>
    <div class="grid grid-flow-row grid-cols-2 lg:grid-cols-4 gap-5">
        <div v-for="item in personalizedMv" :key="item.id" @click="router.push({name:Pages.mvDetail,query:{id:item.id}})">
            <CoverPlay :pic-url="item.picUrl" video :name="item.name" :play-count="item.playCount" show-play-count/>
            <div class="truncate text-xs mt-2">{{ item.name }}</div>
            <div class="truncate text-xs mt-1.5 text-slate-400"><small>{{ item.artistName }}</small></div>
        </div>
    </div>
</template>

<script setup lang="ts">
    import Title from "@/components/common/Title.vue";
    import CoverPlay from "@/components/common/CoverPlay.vue";
    import {onMounted, toRefs} from "vue";
    import {useVideoStore} from "@/stores/video";
    import {useRouter} from "vue-router";

    import {routerPages} from "@/router/pages";
    //把它变为一个响应式对象
    const {personalizedMv} = toRefs(useVideoStore());
    const router = useRouter();

    const {getPersonalizedMv} = useVideoStore();

    onMounted(async () => {
        await getPersonalizedMv()
    })
</script>

<style lang="scss" scoped>

</style>
